﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GMLogging;

namespace ThouShaltNotBrick.Logic.Collisions
{
    public sealed class CollisionObject
    {
        #region Properties
        #region CollisionObjectType
        /// <summary>
        /// CollisionObjectType property.
        /// </summary>
        public CollisionObjectType CollisionObjectType { get; private set; }
        #endregion

        #region CollisionSide
        /// <summary>
        /// CollisionSide property.
        /// </summary>
        public CollisionSide CollisionSide { get; private set; }
        #endregion

        #region BrickRow
        /// <summary>
        /// BrickRow property.
        /// </summary>
        public int BrickRow { get; private set; }
        #endregion

        #region BrickColumn
        /// <summary>
        /// BrickColumn property.
        /// </summary>
        public int BrickColumn { get; private set; }
        #endregion
        #endregion

        #region Constructors
        public CollisionObject(
            CollisionObjectType pCollisionObjectType,
            CollisionSide pCollisionSide,
            int pBrickRow,
            int pBrickColumn)
        {
            if (pCollisionObjectType != CollisionObjectType.Brick)
            {
                string errorMessage = string.Format("Invalid 'pCollisionObjectType' argument ({0}) for this constructor.");
                Logger.Error(errorMessage);
                throw new ArgumentException(errorMessage, "pCollisionObjectType");
            }

            Initialize(
                pCollisionObjectType,
                pCollisionSide,
                pBrickRow,
                pBrickColumn);
        }

        public CollisionObject(
            CollisionObjectType pCollisionObjectType,
            CollisionSide pCollisionSide)
        {
            if (pCollisionObjectType == CollisionObjectType.Brick)
            {
                string errorMessage = string.Format("Invalid 'pCollisionObjectType' argument ({0}) for this constructor.");
                Logger.Error(errorMessage);
                throw new ArgumentException(errorMessage, "pCollisionObjectType");
            }

            Initialize(
                pCollisionObjectType,
                pCollisionSide,
                0,
                0);
        }
        #endregion

        #region Methods
        private void Initialize(
            CollisionObjectType pCollisionObjectType,
            CollisionSide pCollisionSide,
            int pBrickRow,
            int pBrickColumn)
        {
            CollisionObjectType = pCollisionObjectType;
            CollisionSide = pCollisionSide;
            BrickRow = pBrickRow;
            BrickColumn = pBrickColumn;
        }
        #endregion
    }
}